package edu.stu.book.book.keeping.component

import android.content.Context
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import edu.stu.book.book.keeping.R
import edu.stu.book.book.keeping.db.dao.Cost
import edu.stu.book.book.keeping.utils.ColorUtils
import edu.stu.book.book.keeping.utils.TimeUtils

@Composable
fun CostHeaderItem(
    context: Context,
    date: String,
    profit: Double,
    loss: Double,
    modifier: Modifier = Modifier
) {

    Row(
        modifier = modifier
            .height(20.dp)
            .fillMaxWidth()
            .background(Color.White),
        horizontalArrangement = Arrangement.SpaceBetween,
        verticalAlignment = Alignment.CenterVertically
    ) {
        Text(
            text = date,
            color = ColorUtils.getColor(context, R.color.gray),
            modifier = modifier.weight(3f)
        )
        Row(
            modifier = modifier.weight(2f),
            horizontalArrangement = Arrangement.SpaceBetween,
            verticalAlignment = Alignment.CenterVertically
        ) {
            Text(
                text = "收入：${profit}",
                color = ColorUtils.getColor(context, R.color.gray),
            )
            Text(
                text = "支出：${loss}",
                color = ColorUtils.getColor(context, R.color.gray),
            )
        }
    }
}
